/*
 * Copyright 2010 EES GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.eesgmbh.gimv.samples.googlechartapi.client.linecolors;

import org.eesgmbh.gimv.client.event.FilteredDispatchGwtEvent;

/**
 * Event for changing the color of a graph in the chart image.
 *
 * @author Sascha Hagedorn - EES GmbH - s.hagedorn@ees-gmbh.de
 *
 */
public class ChangeLineColorsEvent extends FilteredDispatchGwtEvent<ChangeLineColorsEventHandler> {

	public static Type<ChangeLineColorsEventHandler> TYPE = new Type<ChangeLineColorsEventHandler>();

	private final int index;
	private final String colorCode;

	public ChangeLineColorsEvent(int index, String colorCode) {
		this.index = index;
		this.colorCode = colorCode;
	}

	/**
	 * Get the index of the graph this event applies to
	 * @return
	 */
	public int getIndex() {
		return index;
	}

	/**
	 * Get the color code for the new color of the graph
	 * @return
	 */
	public String getColorCode() {
		return colorCode;
	}


	@Override
	protected void onDispatch(ChangeLineColorsEventHandler handler) {
		handler.onChangeLineColors(this);
	}

	@Override
	public Type<ChangeLineColorsEventHandler> getAssociatedType() {
		return TYPE;
	}

}
